<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html lang="zh-CN">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>Bootstrap 101 Template</title>
    <link href="../css/bootstrap.min.css" rel="stylesheet">
</head>
<body>
<div class="container">
    <div class="row">
        <nav class="navbar navbar-default">
            <div class="container-fluid">
                <!-- Brand and toggle get grouped for better mobile display -->
                <div class="navbar-header">
                    <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1" aria-expanded="false">
                        <span class="sr-only">Toggle navigation</span>
                        <span class="icon-bar"></span>
                        <span class="icon-bar"></span>
                        <span class="icon-bar"></span>
                    </button>
                    <a class="navbar-brand" href="#">21Cake</a>
                </div>
                <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
                    <ul class="nav navbar-nav">
                        <li class="active"><a href="#">首页 <span class="sr-only">(current)</span></a></li>                          
                          
                    </ul>
                    <form class="navbar-form navbar-left" action="cakelist.html" method="get">
                        <div class="form-group">
                        <select class="form-control" name="cid">
							<option value="0">商品分类</option>
							<c:forEach var="c" items="${categories}">
								<c:if test="${c.id==cid}">
								<option value="${c.id}" selected="selected">${c.name}</option>
								</c:if>
								<c:if test="${c.id!=cid}">
								<option value="${c.id}">${c.name}</option>
								</c:if>
							</c:forEach>
						</select>
                            <input name="title" type="text" class="form-control" placeholder="- - - 蛋糕名查询 - - -" value="${param.title}">
                        </div>
                        <button type="submit" class="btn btn-default">查询</button>
                        <a href="cakeEdit.html" class="btn btn-default">添加蛋糕</a>
                    </form>
                    <ul class="nav navbar-nav navbar-right">
                        <li><a href="adminLogin">注销</a></li>
                        <li><a href="#">${LoginAdmin.userName}</a></li>
                        <li class="dropdown">
                            <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">用户中心<span class="caret"></span></a>
                            <ul class="dropdown-menu">
                                <li><a href="#">增加管理员</a></li>
                                <li><a href="#">修改密码</a></li>
                                <li><a href="#">修改用户名</a></li>
                                <li role="separator" class="divider"></li>
                                <li><a href="#">Separated link</a></li>
                            </ul>
                        </li>
                    </ul>
                </div>
            </div>
        </nav>
    </div>
    <div class="row">
        <div class="col-sm-2">
            <ul class="list-group">
                <li class="list-group-item"><a href="orderlist.html">订单列表</a></li>
                <li class="list-group-item"><a href="userlist.jsp">用户列表</a></li>
                <li class="list-group-item"><a href="cakelist.html">商品列表</a></li>
                <li class="list-group-item"><a href="comm.html">评论列表</a></li>
            </ul>
        </div>
        <div class="col-sm-10">

        	<c:forEach var="k" items="${cakes}">       	
	        	<div class="col-xs-4 col-sm-4">
	                    <div class="thumbnail">
	                    	<p style="color: brown">蛋糕编号：${k.id}</p>
	                   	    <img src="../image/productImg/${k.mainimg}" alt="...">
	                        <div class="caption">
	                        
	                            <h5>${k.getcategoryname(k.categoryid)}</h5>
	                            <p>${k.name}</p>
	                            <p><a href="cakeEdit.html?kid=${k.id}" class="btn btn-primary" role="button">编辑</a>
	                             <a href="cakelist.html?did=${k.id }" class="btn btn-default" role="button">上下架</a>
	                             <a href="AddCakeImg.html?cid=${k.id }" class="btn btn-default" role="button">添加图</a>
	                             <c:if test="${k.cakeStatus==false}">
	                             <span style="color: red">已下架</span>
	                             </c:if>
	                             </p> 
	                                                       
	                        </div>
	                    </div>
	              </div>	             
              </c:forEach>                                                                   				
        </div>       
    </div>
     <div>
        	<p style="text-align:center">
               <c:if test="${pageNum>1}">
                    <a href="?cid=${cid}&pageNum=${pageNum-1}">上一页</a>
                    </c:if>
                    <c:if test="${pageNum<=1}">
                    <a>上一页</a>
                    </c:if>
                    ${pageNum}/${totalPage}
                    <c:if test="${pageNum<totalPage}">
                    <a href="?cid=${cid}&pageNum=${pageNum+1}">下一页</a>
                    </c:if>
                    <c:if test="${pageNum>=totalPage}">
                    <a>下一页</a>
                 </c:if> 
               </p>
         </div> 
</div>
<script src="../js/jquery-1.11.3.js"></script>
<script src="../js/bootstrap.min.js"></script>
</body>
</html>
